package com.blueocean_health.care.management.common.context;

import com.blueocean_health.care.management.domain.base.User;
import com.blueocean_health.care.management.domain.base.UserPatient;
/**
 * 用户管理
 * @author wuyanli
 *
 */
public class UserContext {
private UserContext(){}
	
	private static UserContext instance = new UserContext();
	
	public static UserContext getInstance1() {
		return instance;
	}

	private ThreadLocal<Object> userThreadLocal = 
			new ThreadLocal<>();
			
	public void bind(Object user){
		userThreadLocal.set(user);
	}
	
	public User get(){
		return (User) userThreadLocal.get();
	}
	public UserPatient getAppUser(){
		return (UserPatient) userThreadLocal.get();
	}
	
	public void remove(){
		userThreadLocal.remove();
	}
}
